<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\FrontUser */

$this->title = $model->username;
$this->params['breadcrumbs'][] = ['label' => '经销商管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="front-user-view">

    <p>
        <?= Html::a('编辑', ['update', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ]) ?>
        <?= Html::a('重置密码', ['reset-password', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
        <?= Html::a('上传电子版品牌授权证书', ['upload-file', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
        <?= Html::a('相关产品添加', ['create-product', 'id' => $model->id], ['class' => 'btn btn-info']) ?>
    </p>
    <div class="row">
        <div class="col-md-6">
            <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                [
                    'label' => '用户名',
                    'format' => 'raw',
                    'attribute' => 'username',
                    'value' => function($model) {
                        return $model->username;
                    },
                ],
                'company_name',
                // 'auth_key',
                // 'password_hash',
                // 'password_reset_token',
                'email:email',
                [
                    'label' => '状态',
                    'format' => 'raw',
                    'attribute' => 'status',
                    'value' => function($model) {
                        if($model->status == 10){
                            return '<span class="btn btn-success btn-xs">可用</span>';
                        }else{
                            return '<span class="btn btn-danger btn-xs">不可用</span>';
                        }
                    },
                ],
                [
                    'label' => '创建时间',
                    'format' => 'raw',
                    'attribute' => 'created_at',
                    'value' => function($model) {
                        return date('Y-m-d H:i',$model->created_at);
                    },
                ],
                [
                    'label' => '更新时间',
                    'format' => 'raw',
                    'attribute' => 'updated_at',
                    'value' => function($model) {
                        return date('Y-m-d H:i',$model->updated_at);
                    },
                ],
            ],
        ]) ?>
        </div>
    </div>
    

</div>
